package com.neusoft.his.sb.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.his.sb.entity.CommonResult;
import com.neusoft.his.sb.entity.Emp;
import com.neusoft.his.sb.service.EmpService;

@RestController
@CrossOrigin("*")
@RequestMapping("/emp")
public class EmpController {
	@Autowired
	EmpService  empService;
//	 /emp/tree/{empno}
	@GetMapping("/tree/{empno}")
	public CommonResult getByIdInTree(@PathVariable("empno") int empno) {
		CommonResult result =  empService.getByIdInTree(empno);
		return result;
	}
	
	@GetMapping("/les/{empno}")
	public CommonResult getByIdWithEmp(@PathVariable("empno") int empno) {
		CommonResult result =  empService.getByIdWithEmp(empno);
		return result;
	}
	
	@GetMapping("/leader/{empno}")
	public CommonResult getByIdWithLeader(@PathVariable("empno") int empno) {
		CommonResult result =  empService.getByIdWithLeader(empno);
		return result;
	}
	
	@GetMapping("/{empno}")
	public CommonResult getById(@PathVariable("empno") int empno) {
		CommonResult result =  empService.getById(empno);
		return result;
	}

}
